/**
 * losenote.com Inc.
 * Copyright (c) 2013-2013 All Rights Reserved.
 */
package com.losenote.model.ct;

import com.losenote.model.ContactDetail;
import com.losenote.orm.ContactDetailDO;

/**
 * 联系信息转换器
 * 
 * @author danjingyu
 * @version $Id: ContactDetailConvertor.java, v 0.1 2013-10-27 下午4:11:45 danjingyu Exp $
 */
public class ContactDetailConvertor {

    /**
     * model对象转换器
     * @param contactDetail
     * @return
     */
    public static ContactDetailDO fromModel(ContactDetail contactDetail) {
        ContactDetailDO contactInfoDO = new ContactDetailDO();
        contactInfoDO.setAddress(contactDetail.getAddress());
        contactInfoDO.setMail(contactDetail.getMail());
        contactInfoDO.setMobile(contactDetail.getMobile());
        contactInfoDO.setName(contactDetail.getName());
        contactInfoDO.setQq(contactDetail.getQq());
        contactInfoDO.setTelPhone(contactDetail.getTelPhone());
        contactInfoDO.setGmtCreate(contactDetail.getGmtCreate());
        contactInfoDO.setGmtModified(contactDetail.getGmtModified());
        return contactInfoDO;
    }

    /**
     * do对象转换器
     * 
     * @param contactDetail
     * @return
     */
    public static ContactDetail fromDO(ContactDetailDO contactDetailDO) {
        if (contactDetailDO == null) {
            return null;
        }
        ContactDetail contactInfo = new ContactDetail();
        contactInfo.setId(contactDetailDO.getId());
        contactInfo.setAddress(contactDetailDO.getAddress());
        contactInfo.setMail(contactDetailDO.getMail());
        contactInfo.setMobile(contactDetailDO.getMobile());
        contactInfo.setName(contactDetailDO.getName());
        contactInfo.setQq(contactDetailDO.getQq());
        contactInfo.setTelPhone(contactDetailDO.getTelPhone());
        contactInfo.setGmtCreate(contactDetailDO.getGmtCreate());
        contactInfo.setGmtModified(contactDetailDO.getGmtModified());
        return contactInfo;
    }
}
